package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ScreenUtils;
import com.corona.Game;
import com.corona.game.util.TextureCache;
import com.corona.game.util.audio.AudioLoader;
import com.sun.jna.platform.win32.WinError;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Random;

/* compiled from: Battle.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo.class */
public class SpecialBattleMewtwo extends Action {
    Music music;
    SpecialMewtwo1 mewtwo;
    public static boolean doneYet = false;
    public static int specialAttackCounter = 0;
    public Action.Layer layer = Action.Layer.gui_106;
    boolean firstStep = true;
    int timer = 0;

    public SpecialBattleMewtwo(Game game, SpecialMewtwo1 mewtwo) {
        super(new Object[0]);
        this.mewtwo = mewtwo;
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        Action action;
        if (this.firstStep) {
            if (!Game.musicDisabled) {
                game.currMusic.pause();
                if (!game.loadedMusic.containsKey("music/pokemon_mansion_remix_eq")) {
                    Music music = AudioLoader.loadMusic("music/pokemon_mansion_remix_eq.ogg");
                    music.setLooping(true);
                    game.loadedMusic.put("music/pokemon_mansion_remix_eq", music);
                }
                this.music = game.loadedMusic.get("music/pokemon_mansion_remix_eq");
                this.music.setVolume(0.7f);
                game.currMusic = this.music;
                game.currMusic.play();
            }
            if (doneYet) {
                this.timer = WinError.RPC_S_NO_ENDPOINT_FOUND;
                game.currMusic.setPosition(28.55f);
            }
            doneYet = true;
            specialAttackCounter = 0;
            this.firstStep = false;
        }
        if (this.timer != 0) {
            if (this.timer == 100) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "Humans...", null, null, false, null));
            } else if (this.timer == 280) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "They cared nothing for me...", null, null, false, null));
            } else if (this.timer == 560) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "From the moment I first opened my eyes, they have sought to control me...", null, null, false, null));
            } else if (this.timer == 960) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "But no more.", null, null, false, null));
            } else if (this.timer == 1160) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "Why are you here?", null, null, false, null));
            } else if (this.timer == 1310) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "You seek to control me, just like the others.", null, null, false, null));
            } else if (this.timer == 1580) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "...", null, null, false, null));
            }
        }
        if (this.timer >= 1708) {
            game.actionStack.remove(game.displayTextAction);
            game.displayTextAction = null;
            Action triggerAction = new PlaySound(game.player.currPokemon, new WaitFrames(game, game.player.currPokemon.specie.cryLengthInFrames(), new WaitFrames(game, 6, new DrawFriendlyHealthGen2(game, new WaitFrames(game, 15, new DrawBattleMenuNormal(game, null))))));
            Action nextAction = new BattleIntro(new BattleIntro1(new SplitAction(new DrawBattle1(game), new SplitAction(new DrawBreathingSprite(this.mewtwo), new SplitAction(new RocksEffect2(), new IntroAnim(game, new SplitAction(new RocksEffect1(), new SplitAction(new RippleEffect1(), null))))))));
            if (this.mewtwo.isShiny) {
                nextAction.append(new Battle.LoadAndPlayAnimation(game, "shiny", game.player.currPokemon, null));
            }
            int cryLengthInFrames = game.battle.oppPokemon.specie.cryLengthInFrames();
            String str = "Wild " + game.battle.oppPokemon.nickname.toUpperCase(Locale.ROOT) + " appeared!";
            WaitFrames waitFrames = new WaitFrames(game, 1, new DrawEnemyHealthGen2(game));
            String str2 = "Go! " + game.player.currPokemon.nickname.toUpperCase(Locale.ROOT) + "!";
            if (game.player.currPokemon.isShiny) {
                action = new Battle.LoadAndPlayAnimation(game, "shiny", game.battle.oppPokemon, triggerAction);
            } else {
                action = triggerAction;
            }
            nextAction.append(new PlaySound("150", 0.8f, new WaitFrames(game, cryLengthInFrames, new DisplayText(game, str, (String) null, (Action) null, new SplitAction(waitFrames, new WaitFrames(game, 39, new MovePlayerOffScreen(game, new DisplayText(game, str2, (String) null, triggerAction, new ThrowOutPokemonCrystal(game, action)))))))));
            game.actionStack.remove(this);
            game.insertAction(nextAction);
        }
        this.timer++;
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$BattleIntro1.class */
    class BattleIntro1 extends Action {
        Sprite frame;
        public Action.Layer layer = Action.Layer.gui_139;
        ArrayList<Sprite> frames = new ArrayList<>();

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public BattleIntro1(Action nextAction) {
            super(new Object[0]);
            SpecialBattleMewtwo.this = this$0;
            this.nextAction = nextAction;
            Texture text1 = TextureCache.get(Gdx.files.internal("battle/battle_intro_anim1_sheet1.png"));
            for (int i = 0; i < 28; i++) {
                this.frames.add(new Sprite(text1, i * 160, 0, 160, 144));
            }
            for (int i2 = 0; i2 < 126; i2++) {
                this.frames.add(new Sprite(text1, (int) WinError.ERROR_REQUEST_REFUSED, 0, 160, 144));
            }
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.frames.isEmpty()) {
                game.insertAction(this.nextAction);
                game.actionStack.remove(this);
                this.nextAction.step(game);
                return;
            }
            this.frame = this.frames.get(0);
            if (this.frame != null) {
                this.frame.draw(game.uiBatch);
            }
            this.frames.remove(0);
        }
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$DrawBattle1.class */
    class DrawBattle1 extends DrawBattle {
        public Action.Layer layer = Action.Layer.gui_130;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public DrawBattle1(Game game) {
            super(game);
            SpecialBattleMewtwo.this = this$0;
        }

        @Override // com.corona.game.DrawBattle, com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.DrawBattle, com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.DrawBattle, com.corona.game.Action
        public void step(Game game) {
            if (shouldDrawOppPokemon) {
                game.battle.oppPokemon.sprite.draw(game.uiBatch);
            }
            game.player.battleSprite.draw(game.uiBatch);
        }
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$DrawBreathingSprite.class */
    static class DrawBreathingSprite extends Action {
        static boolean shouldBreathe = false;
        SpecialMewtwo1 mewtwo;
        public Action.Layer layer = Action.Layer.gui_129;
        int timer = 300;
        int offsetY = 0;
        Sprite bgSprite2 = new Sprite(TextureCache.get(Gdx.files.internal("battle/intro_frame6.png")), 0, 0, 160, 144);

        public DrawBreathingSprite(SpecialMewtwo1 mewtwo) {
            super(new Object[0]);
            this.mewtwo = mewtwo;
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (shouldBreathe) {
                this.timer--;
                if (this.timer == 149) {
                    this.offsetY = -1;
                } else if (this.timer == 0) {
                    this.timer = 300;
                    this.offsetY = 0;
                }
            }
            if (DrawBattle.shouldDrawOppPokemon) {
                this.mewtwo.breathingSprite.setPosition(this.mewtwo.sprite.getX(), this.mewtwo.sprite.getY() + ((float) this.offsetY));
                this.mewtwo.breathingSprite.draw(game.uiBatch);
            }
            for (int i = -1; i < 2; i++) {
                for (int j = -1; j < 2; j++) {
                    if (i != 0 || j != 0) {
                        game.uiBatch.draw(this.bgSprite2, (float) (160 * i), (float) (144 * j));
                    }
                }
            }
            if (game.battle.drawAction == null) {
                game.actionStack.remove(this);
            }
        }
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$IntroAnim.class */
    static class IntroAnim extends Action {
        Vector2 move;
        public Action.Layer layer = Action.Layer.gui_140;
        int timer = 0;
        ArrayList<Vector2> moves_relative = new ArrayList<>();

        public IntroAnim(Game game, Action nextAction) {
            super(new Object[0]);
            this.nextAction = nextAction;
            for (int i = 0; i < 144; i++) {
                this.moves_relative.add(new Vector2(1.0f, 0.0f));
            }
            game.player.battleSprite.setPosition(162.0f, 49.0f);
            game.battle.oppPokemon.sprite.setPosition(-49.0f, 88.0f);
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        String getShader(float level) {
            return "#ifdef GL_ES\n    precision mediump float;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texCoords;\nuniform sampler2D u_texture;\n\nvoid main() {\n    vec4 color = texture2D (u_texture, v_texCoords) * v_color;\n    float level = " + level + ";\n    if (color.r >= .9 && color.g >= .9 && color.b >= .9) {\n           color = vec4(color.r, color.g, color.b, color.a);\n    }\n    else {\n        color = vec4(color.r-level, color.g-level, color.b-level, color.a);\n    }\n    gl_FragColor = color;\n}";
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (!this.moves_relative.isEmpty()) {
                this.move = this.moves_relative.get(0);
                game.player.battleSprite.setX(game.player.battleSprite.getX() - this.move.x);
                game.battle.oppPokemon.sprite.setX(game.battle.oppPokemon.sprite.getX() + this.move.x);
                this.moves_relative.remove(0);
                if (this.moves_relative.isEmpty()) {
                    game.insertAction(new DisplayTextIntro(game, "An oppressive force surrounds you...", null, null, false, null));
                }
            }
            if (this.timer == 380) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.insertAction(new DisplayTextIntro(game, "MEWTWO unleashes its full power!", null, null, false, null));
            }
            if (this.timer == 0) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(0.8f)));
            }
            if (this.timer == 490) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(0.6f)));
            } else if (this.timer == 496) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(0.4f)));
            } else if (this.timer == 502) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(0.2f)));
            } else if (this.timer == 508) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(0.0f)));
            } else if (this.timer == 514) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.2f)));
            } else if (this.timer == 520) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.4f)));
            } else if (this.timer == 526) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.6f)));
            } else if (this.timer == 532) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.8f)));
            } else if (this.timer == 538) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.85f)));
            } else if (this.timer == 544) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.9f)));
            } else if (this.timer == 550) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.95f)));
            } else if (this.timer == 556) {
                game.actionStack.remove(game.displayTextAction);
                game.displayTextAction = null;
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-1.0f)));
            } else if (this.timer == 607) {
                game.uiBatch.setShader(new ShaderProgram(EvolutionAnim.vertexShader, getShader(-0.5f)));
            } else if (this.timer == 609) {
                game.uiBatch.setShader(null);
            } else if (this.timer == 620) {
                DrawBreathingSprite.shouldBreathe = true;
            }
            if (this.timer >= 640) {
                game.actionStack.remove(this);
                game.insertAction(this.nextAction);
            }
            this.timer++;
        }
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$RippleEffect1.class */
    class RippleEffect1 extends Action {
        ShaderProgram shader;
        Pixmap pixmap;
        public Action.Layer layer = Action.Layer.gui_109;
        int yPos = -16;
        int[] offsets = {0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 3, 2, 2, 2, 1};
        Sprite sprite = new Sprite(TextureCache.get(Gdx.files.internal("battle/pixel1.png")), 0, 0, 1, 1);
        String fragShader = "precision mediump float;\nvarying vec4 v_color;\nvarying vec2 v_texCoords;\nuniform sampler2D u_texture;\nuniform mat4 u_projTrans;\nbool equals(float a, float b) {\n    return abs(a-b) < 0.0001;\n}\nvoid main() {\n    vec4 color = texture2D (u_texture, v_texCoords) * v_color;\n    gl_FragColor = color;\n}\n";

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public RippleEffect1() {
            super(new Object[0]);
            SpecialBattleMewtwo.this = this$0;
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        String getVertexShader(int timer) {
            return "attribute vec4 a_position;\nattribute vec4 a_color;\nattribute vec2 a_texCoord;\nattribute vec2 a_texCoord0;\nuniform mat4 u_projTrans;\nvarying vec4 v_color;\nvarying vec2 v_texCoords;\nvoid main()\n{\n    v_color = a_color;\n    v_texCoords = a_texCoord0;\n    int timer = " + timer + ";\n    int offset = (timer + int(a_position.y)) % 16;\n        if (offset == 0 || offset == 4) {offset = 0;}\n        else if (offset == 1 || offset == 3) {offset = 1;}\n        else if (offset == 2) {offset = 2;}\n        else if (offset == 5 || offset == 7) {offset = -1;}\n        else if (offset == 6) {offset = -2;}\n    gl_Position =  u_projTrans * vec4(a_position.x + offset, a_position.y, a_position.z, 1.0);\n}\n";
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.yPos <= 144) {
                this.pixmap = ScreenUtils.getFrameBufferPixmap(0, this.yPos * 3, 480, 48);
                for (int j = 0; j < 16; j++) {
                    for (int i = 0; i < 160; i++) {
                        this.sprite.setColor(new Color(this.pixmap.getPixel(i * 3, j * 3)));
                        this.sprite.setPosition((float) (i + this.offsets[j]), (float) (j + this.yPos));
                        this.sprite.draw(game.uiBatch);
                    }
                }
            }
            if (this.yPos > 576) {
                this.yPos = 0;
            }
            if (this.yPos % 2 == 0) {
                this.yPos += 3;
            } else {
                this.yPos += 4;
            }
            if (game.battle.drawAction == null) {
                game.actionStack.remove(this);
            }
        }
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$RocksEffect1.class */
    static class RocksEffect1 extends Action {
        public static int velocityX = 0;
        public static boolean shouldMoveX = false;
        public static boolean shouldMoveY = true;
        public Action.Layer layer = Action.Layer.gui_111;
        Sprite[] sprites = new Sprite[10];
        int[] velocities = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
        int[] velocities2 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
        int velocity = 1;
        int whichVelocity = 0;
        Random rand = new Random();
        boolean firstStep = true;
        Sprite textboxSprite = new Sprite(TextureCache.get(Gdx.files.internal("battle/battle_bg4.png")), 0, 0, 176, 160);

        public RocksEffect1() {
            super(new Object[0]);
            this.textboxSprite.setPosition(-8.0f, -8.0f);
            Texture text = TextureCache.get(Gdx.files.internal("battle/rock1.png"));
            this.sprites[0] = new Sprite(text, 0, 0, 32, 32);
            this.sprites[0].setColor(1.0f, 1.0f, 1.0f, 1.0f);
            this.sprites[1] = new Sprite(text, 32, 0, 32, 32);
            this.sprites[2] = new Sprite(text, 64, 0, 32, 32);
            this.sprites[3] = new Sprite(text, 160, 0, 32, 32);
            this.sprites[4] = new Sprite(text, 192, 0, 32, 32);
            this.sprites[5] = new Sprite(text, 32, 0, 32, 32);
            this.sprites[6] = new Sprite(text, 64, 0, 32, 32);
            this.sprites[7] = new Sprite(text, 160, 0, 32, 32);
            this.sprites[8] = new Sprite(text, 192, 0, 32, 32);
            this.sprites[9] = new Sprite(text, 0, 0, 32, 32);
            this.sprites[9].setColor(1.0f, 1.0f, 1.0f, 1.0f);
            for (int i = 0; i < 10; i++) {
                this.sprites[i].setPosition((float) this.rand.nextInt(128), (float) (this.rand.nextInt(144) - 144));
                this.velocities[i] = this.rand.nextInt(2) + 1;
                this.velocities2[i] = (this.velocities[i] - 1) + this.rand.nextInt(2);
            }
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.firstStep) {
                RocksEffect2.drawRocks = true;
                this.firstStep = false;
            }
            for (int i = 0; i < 10; i++) {
                if (this.whichVelocity == 0) {
                    this.velocity = this.velocities[i];
                } else {
                    this.velocity = this.velocities2[i];
                }
                if (!shouldMoveY) {
                    this.velocity = 0;
                }
                this.sprites[i].setPosition(this.sprites[i].getX() + ((float) velocityX), this.sprites[i].getY() + ((float) this.velocity));
                if (this.sprites[i].getY() > 144.0f) {
                    this.sprites[i].setPosition((float) this.rand.nextInt(128), (float) (this.rand.nextInt(144) - 144));
                    this.velocities[i] = this.rand.nextInt(2) + 1;
                    this.velocities2[i] = (this.velocities[i] - 1) + this.rand.nextInt(2);
                }
                if (this.sprites[i].getX() < 0.0f) {
                    this.sprites[i].setPosition(160.0f, (float) (this.rand.nextInt(144) - 32));
                }
                this.sprites[i].draw(game.uiBatch);
            }
            this.whichVelocity = (this.whichVelocity + 1) % 2;
            this.textboxSprite.draw(game.uiBatch);
            if (game.battle.drawAction == null) {
                game.actionStack.remove(this);
            }
        }
    }

    /* compiled from: Battle.java */
    /* loaded from: pokewilds.jar:com/pkmngen/game/SpecialBattleMewtwo$RocksEffect2.class */
    static class RocksEffect2 extends Action {
        public static int velocityX = 0;
        public static boolean shouldMoveX = false;
        public static boolean shouldMoveY = true;
        static boolean drawRocks = false;
        public Action.Layer layer = Action.Layer.gui_131;
        Sprite[] sprites = new Sprite[10];
        int[] velocities = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
        int[] velocities2 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
        int velocity = 1;
        int whichVelocity = 0;
        Random rand = new Random();
        float[] bg_values = {0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 8.0f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 8.0f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f};
        int bg_values_idx = 0;
        float curr_value = 0.0f;
        Sprite bgSprite = new Sprite(TextureCache.get(Gdx.files.internal("battle/battle_bg3.png")), 0, 0, 176, 160);
        Sprite bgSprite2 = new Sprite(TextureCache.get(Gdx.files.internal("battle/battle_bg5.png")), 0, 0, 176, 160);

        public RocksEffect2() {
            super(new Object[0]);
            this.bgSprite.setPosition(-8.0f, -8.0f);
            this.bgSprite2.setPosition(-8.0f, -8.0f);
            Texture text = TextureCache.get(Gdx.files.internal("battle/rock1.png"));
            this.sprites[0] = new Sprite(text, 0, 0, 32, 32);
            this.sprites[0].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[1] = new Sprite(text, 32, 0, 32, 32);
            this.sprites[1].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[2] = new Sprite(text, 64, 0, 32, 32);
            this.sprites[2].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[3] = new Sprite(text, 160, 0, 32, 32);
            this.sprites[3].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[4] = new Sprite(text, 0, 0, 32, 32);
            this.sprites[4].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[5] = new Sprite(text, 32, 0, 32, 32);
            this.sprites[5].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[6] = new Sprite(text, 64, 0, 32, 32);
            this.sprites[6].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[7] = new Sprite(text, 160, 0, 32, 32);
            this.sprites[7].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[8] = new Sprite(text, 0, 0, 32, 32);
            this.sprites[8].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            this.sprites[9] = new Sprite(text, 0, 0, 32, 32);
            this.sprites[9].setColor(0.0f, 0.0f, 0.0f, 1.0f);
            for (int i = 0; i < 10; i++) {
                this.sprites[i].setPosition((float) this.rand.nextInt(128), (float) (this.rand.nextInt(46) + 20));
                this.velocities[i] = this.rand.nextInt(5) + 4;
                this.velocities2[i] = this.velocities[i];
                this.sprites[i].setRotation((float) (this.rand.nextInt(4) * 90));
            }
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "gui";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            this.bgSprite.draw(game.uiBatch);
            if (drawRocks) {
                for (int i = 0; i < 10; i++) {
                    if (this.velocities2[i] <= 0) {
                        this.velocity = 1;
                        this.velocities2[i] = this.velocities[i];
                    } else {
                        this.velocity = 0;
                    }
                    int[] iArr = this.velocities2;
                    iArr[i] = iArr[i] - 1;
                    if (!shouldMoveY) {
                        this.velocity = 0;
                    }
                    this.sprites[i].setPosition(this.sprites[i].getX() + ((float) velocityX), this.sprites[i].getY() + ((float) this.velocity));
                    if (this.sprites[i].getY() > 144.0f) {
                        this.sprites[i].setPosition((float) this.rand.nextInt(128), (float) (this.rand.nextInt(46) + 20));
                        this.sprites[i].setRotation((float) (this.rand.nextInt(4) * 90));
                        this.velocities[i] = this.rand.nextInt(5) + 4;
                        this.velocities2[i] = this.velocities[i];
                    }
                    if (this.sprites[i].getX() < 0.0f) {
                        this.sprites[i].setPosition(160.0f, (float) this.rand.nextInt(112));
                        this.sprites[i].setRotation((float) (this.rand.nextInt(4) * 90));
                    }
                    this.sprites[i].draw(game.uiBatch);
                }
                this.whichVelocity = (this.whichVelocity + 1) % 2;
                this.bgSprite2.draw(game.uiBatch);
            }
            if (game.battle.drawAction == null) {
                game.actionStack.remove(this);
            }
        }
    }
}
